<!DOCTYPE html>



  


<html class="theme-next gemini use-motion" lang="zh-Hans">
<head><meta name="generator" content="Hexo 3.8.0">
  <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="theme-color" content="#222">









<meta http-equiv="Cache-Control" content="no-transform">
<meta http-equiv="Cache-Control" content="no-siteapp">
















  
  
  <link href="../../../../lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css">




  
  
  
  

  
    
    
  

  

  

  

  

  
    
    
    <link href="//fonts.useso.com/css?family=Lato:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
  






<link href="../../../../lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css">

<link href="../../../../css/main.css?v=5.1.4" rel="stylesheet" type="text/css">


  <link rel="apple-touch-icon" sizes="180x180" href="../../../../images/apple-touch-icon-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="32x32" href="../../../../images/favicon-32x32-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="16x16" href="../../../../images/favicon-16x16-next.png?v=5.1.4">


  <link rel="mask-icon" href="../../../../images/logo.svg?v=5.1.4" color="#222">





  <meta name="keywords" content="Docker,">










<meta name="description" content="之前使用Flask开发了两三个公司或个人使用的平台；在搭建过程当中如果换了环境的话比较麻烦；这次尝试放到docker里面去跑；下面是搭建的一个过程以及对于学习的一个记录，此次web框架还是使用的之前用Flask写的一个基础后台。 部署架构:. ├── README.md ├── docker-compose.yaml              # 使用docker-compose来编排部署 ├──">
<meta name="keywords" content="Docker">
<meta property="og:type" content="article">
<meta property="og:title" content="Nginx-uWsgi-Flask-Supervisord-Redis-MySQL-Docker 部署">
<meta property="og:url" content="http://demo_demo.gitee.io/2018/06/18/nginx-uwsgi-flask-supervisord-redis-mysql-docker-e9-83-a8-e7-bd-b2-2/index.html">
<meta property="og:site_name" content="运维人">
<meta property="og:description" content="之前使用Flask开发了两三个公司或个人使用的平台；在搭建过程当中如果换了环境的话比较麻烦；这次尝试放到docker里面去跑；下面是搭建的一个过程以及对于学习的一个记录，此次web框架还是使用的之前用Flask写的一个基础后台。 部署架构:. ├── README.md ├── docker-compose.yaml              # 使用docker-compose来编排部署 ├──">
<meta property="og:locale" content="zh-Hans">
<meta property="og:image" content="https://raw.githubusercontent.com/guomaoqiu/Nginx-uWsgi-Flask-Supervisord-Redis-MySQL-Docker/master/flask_app_code/screenshots/261529307197_.pic_hd.jpg">
<meta property="og:image" content="https://raw.githubusercontent.com/guomaoqiu/Nginx-uWsgi-Flask-Supervisord-Redis-MySQL-Docker/master/flask_app_code/screenshots/status.jpeg">
<meta property="og:image" content="https://raw.githubusercontent.com/guomaoqiu/Nginx-uWsgi-Flask-Supervisord-Redis-MySQL-Docker/master/flask_app_code/screenshots/login.jpeg">
<meta property="og:image" content="https://raw.githubusercontent.com/guomaoqiu/Nginx-uWsgi-Flask-Supervisord-Redis-MySQL-Docker/master/flask_app_code/screenshots/login_unconfiremd.jpeg">
<meta property="og:image" content="https://raw.githubusercontent.com/guomaoqiu/Nginx-uWsgi-Flask-Supervisord-Redis-MySQL-Docker/master/flask_app_code/screenshots/email.jpeg">
<meta property="og:image" content="https://raw.githubusercontent.com/guomaoqiu/Nginx-uWsgi-Flask-Supervisord-Redis-MySQL-Docker/master/flask_app_code/screenshots/login_ok.jpeg">
<meta property="og:image" content="https://raw.githubusercontent.com/guomaoqiu/Nginx-uWsgi-Flask-Supervisord-Redis-MySQL-Docker/master/flask_app_code/screenshots/db.jpeg">
<meta property="og:image" content="https://raw.githubusercontent.com/guomaoqiu/Nginx-uWsgi-Flask-Supervisord-Redis-MySQL-Docker/master/flask_app_code/screenshots/nginxlog.jpeg">
<meta property="og:image" content="https://raw.githubusercontent.com/guomaoqiu/Nginx-uWsgi-Flask-Supervisord-Redis-MySQL-Docker/master/flask_app_code/screenshots/uwsgilog.jpeg">
<meta property="og:updated_time" content="2018-12-10T06:42:10.000Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Nginx-uWsgi-Flask-Supervisord-Redis-MySQL-Docker 部署">
<meta name="twitter:description" content="之前使用Flask开发了两三个公司或个人使用的平台；在搭建过程当中如果换了环境的话比较麻烦；这次尝试放到docker里面去跑；下面是搭建的一个过程以及对于学习的一个记录，此次web框架还是使用的之前用Flask写的一个基础后台。 部署架构:. ├── README.md ├── docker-compose.yaml              # 使用docker-compose来编排部署 ├──">
<meta name="twitter:image" content="https://raw.githubusercontent.com/guomaoqiu/Nginx-uWsgi-Flask-Supervisord-Redis-MySQL-Docker/master/flask_app_code/screenshots/261529307197_.pic_hd.jpg">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Gemini',
    version: '5.1.4',
    sidebar: {"position":"left","display":"post","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false},
    fancybox: true,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="http://demo_demo.gitee.io/2018/06/18/nginx-uwsgi-flask-supervisord-redis-mysql-docker-e9-83-a8-e7-bd-b2-2/">





  <title>Nginx-uWsgi-Flask-Supervisord-Redis-MySQL-Docker 部署 | 运维人</title>
  








</head>

<body itemscope="" itemtype="http://schema.org/WebPage" lang="zh-Hans">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>
<a href="https://github.com/guomaoqiu" class="github-corner" aria-label="View source on GitHub"><svg width="80" height="80" viewbox="0 0 250 250" style="fill:#FD6C6C; color:#fff; position: absolute; top: 0; border: 0; right: 0;" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"/><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"/><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"/></svg></a><style>.github-corner:hover .octo-arm{animation:octocat-wave 560ms ease-in-out}@keyframes octocat-wave{0%,100%{transform:rotate(0)}20%,60%{transform:rotate(-25deg)}40%,80%{transform:rotate(10deg)}}@media (max-width:500px){.github-corner:hover .octo-arm{animation:none}.github-corner .octo-arm{animation:octocat-wave 560ms ease-in-out}}</style>
    <header id="header" class="header" itemscope="" itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">运维人</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle">生命在于折腾</p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br>
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-about">
          <a href="" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-user"></i> <br>
            
            关于
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br>
            
            标签
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br>
            
            分类
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br>
            
            归档
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal" itemscope="" itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="http://demo_demo.gitee.io">

    <span hidden itemprop="author" itemscope="" itemtype="http://schema.org/Person">
      <meta itemprop="name" content="OutMan">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="https://raw.githubusercontent.com/guomaoqiu/myblog_backup/master/uploads/myphoto.png">
    </span>

    <span hidden itemprop="publisher" itemscope="" itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="运维人">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">Nginx-uWsgi-Flask-Supervisord-Redis-MySQL-Docker 部署</h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2018-06-18T17:37:35+08:00">
                2018-06-18
              </time>
            

            

            
          </span>

          
            <span class="post-category">
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope="" itemtype="http://schema.org/Thing">
                  <a href="../../../../categories/Docker/" itemprop="url" rel="index">
                    <span itemprop="name">Docker</span>
                  </a>
                </span>

                
                
                  ， 
                
              
                <span itemprop="about" itemscope="" itemtype="http://schema.org/Thing">
                  <a href="../../../../categories/Docker/自动化运维/" itemprop="url" rel="index">
                    <span itemprop="name">自动化运维</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
          

          
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <p>之前使用Flask开发了两三个公司或个人使用的平台；在搭建过程当中如果换了环境的话比较麻烦；这次尝试放到docker里面去跑；下面是搭建的一个过程以及对于学习的一个记录，此次web框架还是使用的之前用Flask写的一个基础后台。</p>
<h2 id="部署架构"><a href="#部署架构" class="headerlink" title="部署架构:"></a>部署架构:</h2><pre><code>.
├── README.md
├── docker-compose.yaml              # 使用docker-compose来编排部署
├── flask_app                        # 用于跑Flask应用的容器
│   ├── Dockerfile
│   └── wait_for_db_complete.sh
├── flask_app_code                   # 后端项目应用代码目
│   ├── LICENSE
│   ├── README.md
│   ├── app
│   ├── config.py
│   ├── manage.py
│   ├── requirements.txt
│   ├── screenshots
│   └── tests
├── nginx                            # Nginx用于前端接收用户请求的容器
│   └── nginx.conf
├── python27_baseenv                 # 基础Python环境镜像
│   ├── Dockerfile
│   └── README.md
├── supervisor                       # 用于管理uwsgi服务进程
│   └── supervisord.conf
└── uwsgi                            # 通过uWsgi来为Nginx-Flask牵线搭桥
    └── flask_uwsgi.ini
</code></pre><h2 id="访问流程"><a href="#访问流程" class="headerlink" title="访问流程:"></a>访问流程:</h2><p><img src="https://raw.githubusercontent.com/guomaoqiu/Nginx-uWsgi-Flask-Supervisord-Redis-MySQL-Docker/master/flask_app_code/screenshots/261529307197_.pic_hd.jpg" alt=""></p>
<ul>
<li>Nginx Web服务器层作为前端接收用户请求；</li>
<li>uWSGI层作为Web服务器层与Web框架层Flask的一条纽带，将Web服务器层与Web框架连接起来</li>
<li>后端Web框架与数据层MySQL或Redis交互</li>
</ul>
<h3 id="简单理解起来就是酱紫的"><a href="#简单理解起来就是酱紫的" class="headerlink" title="简单理解起来就是酱紫的:"></a>简单理解起来就是酱紫的:</h3><ol>
<li>Nginx：Hey，WSGI，我刚收到了一个请求，我需要你作些准备，然后由Flask来处理这个请求。</li>
<li>WSGI：OK，Nginx。我会设置好环境变量，然后将这个请求传递给Flask处理。</li>
<li>Flask：Thanks WSGI！给我一些时间，我将会把请求的响应返回给你。</li>
<li>WSGI：Alright，那我等你。</li>
<li>Flask：Okay，我完成了，这里是请求的响应结果，请求把结果传递给Nginx。 WSGI：Good job！</li>
<li>Nginx，这里是响应结果，已经按照要求给你传递回来了。</li>
<li>Nginx：Cool，我收到了，我把响应结果返回给客户端。大家合作愉快~</li>
</ol>
<h2 id="搭建思路"><a href="#搭建思路" class="headerlink" title="搭建思路:"></a>搭建思路:</h2><ul>
<li>Nginx 单独一个容器</li>
<li>uWSGI+Flask 单独一个容器，其中uWSGI进程由Supervisor来管理</li>
<li>MySQL 单独一个容器，数据目录挂载到宿主机</li>
<li>Redis 单独一个容器</li>
</ul>
<p>各个容器之间的关联通过docker-compose编排来实现</p>
<h2 id="部署步骤："><a href="#部署步骤：" class="headerlink" title="部署步骤："></a>部署步骤：</h2><p>主要还是通过编写Dockerfile来定制特定的运行环境镜像</p>
<h5 id="0-安装docker环境"><a href="#0-安装docker环境" class="headerlink" title="0.安装docker环境"></a>0.安装docker环境</h5><pre><code>cd /etc/yum.repos.d/
wget https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
yum install -y docker-ce docker-compose
systemctl start docker
</code></pre><h5 id="1-构建python基础运行环境镜像，基于alpine镜像"><a href="#1-构建python基础运行环境镜像，基于alpine镜像" class="headerlink" title="1.构建python基础运行环境镜像，基于alpine镜像"></a>1.构建python基础运行环境镜像，基于alpine镜像</h5><pre><code>cd Nginx-uWsgi-Flask-Supervisord-Redis-MySQL-Docker
docker build -f python27_baseenv/Dockerfile . -t python27_baseenv
</code></pre><h5 id="2-构建Flask应用框架运行所需依赖包镜像"><a href="#2-构建Flask应用框架运行所需依赖包镜像" class="headerlink" title="2.构建Flask应用框架运行所需依赖包镜像"></a>2.构建Flask应用框架运行所需依赖包镜像</h5><pre><code>cd Nginx-uWsgi-Flask-Supervisord-Redis-MySQL-Docker
docker build -f flask_app/Dockerfile . -t flask_app
</code></pre><h5 id="4-Nginx镜像使用默认，配置文件需要修改，这里通过挂载方式"><a href="#4-Nginx镜像使用默认，配置文件需要修改，这里通过挂载方式" class="headerlink" title="4.Nginx镜像使用默认，配置文件需要修改，这里通过挂载方式"></a>4.Nginx镜像使用默认，配置文件需要修改，这里通过挂载方式</h5><h5 id="5-Redis镜像使用默认的"><a href="#5-Redis镜像使用默认的" class="headerlink" title="5.Redis镜像使用默认的"></a>5.Redis镜像使用默认的</h5><h5 id="6-执行docker-compose"><a href="#6-执行docker-compose" class="headerlink" title="6.执行docker-compose"></a>6.执行docker-compose</h5><pre><code>cd Nginx-uWsgi-Flask-Supervisord-Redis-MySQL-Docker
docker-compose up
</code></pre><h4 id="运行状态"><a href="#运行状态" class="headerlink" title="运行状态"></a>运行状态</h4><p><img src="https://raw.githubusercontent.com/guomaoqiu/Nginx-uWsgi-Flask-Supervisord-Redis-MySQL-Docker/master/flask_app_code/screenshots/status.jpeg" alt=""></p>
<h4 id="登录"><a href="#登录" class="headerlink" title="登录"></a>登录</h4><p><img src="https://raw.githubusercontent.com/guomaoqiu/Nginx-uWsgi-Flask-Supervisord-Redis-MySQL-Docker/master/flask_app_code/screenshots/login.jpeg" alt=""></p>
<h4 id="用户注册"><a href="#用户注册" class="headerlink" title="用户注册"></a>用户注册</h4><p><img src="https://raw.githubusercontent.com/guomaoqiu/Nginx-uWsgi-Flask-Supervisord-Redis-MySQL-Docker/master/flask_app_code/screenshots/login_unconfiremd.jpeg" alt=""><br><img src="https://raw.githubusercontent.com/guomaoqiu/Nginx-uWsgi-Flask-Supervisord-Redis-MySQL-Docker/master/flask_app_code/screenshots/email.jpeg" alt=""><br><img src="https://raw.githubusercontent.com/guomaoqiu/Nginx-uWsgi-Flask-Supervisord-Redis-MySQL-Docker/master/flask_app_code/screenshots/login_ok.jpeg" alt=""><br><img src="https://raw.githubusercontent.com/guomaoqiu/Nginx-uWsgi-Flask-Supervisord-Redis-MySQL-Docker/master/flask_app_code/screenshots/db.jpeg" alt=""></p>
<h4 id="Flask应用的访问、登录、注册过程日志"><a href="#Flask应用的访问、登录、注册过程日志" class="headerlink" title="Flask应用的访问、登录、注册过程日志"></a>Flask应用的访问、登录、注册过程日志</h4><h5 id="Nginx"><a href="#Nginx" class="headerlink" title="Nginx"></a>Nginx</h5><p><img src="https://raw.githubusercontent.com/guomaoqiu/Nginx-uWsgi-Flask-Supervisord-Redis-MySQL-Docker/master/flask_app_code/screenshots/nginxlog.jpeg" alt=""></p>
<h5 id="uWSGI"><a href="#uWSGI" class="headerlink" title="uWSGI"></a>uWSGI</h5><p><img src="https://raw.githubusercontent.com/guomaoqiu/Nginx-uWsgi-Flask-Supervisord-Redis-MySQL-Docker/master/flask_app_code/screenshots/uwsgilog.jpeg" alt=""></p>
<h2 id="部署总结"><a href="#部署总结" class="headerlink" title="部署总结:"></a>部署总结:</h2><p>部署过程中，感觉在宿主机中部署还是没多大的区别，差别可能是在效率上面。宿主机中不能影响系统自带的一些东西，比如python的版本，这时候可能就需要用到virtualenv, 如果服务器迁移了那整个环境就需要重新搭建，还是不太方便。</p>
<p>此次部署呢主要目的还是以这个为一个实践目标去学习docker的compose文件编写，再把各个工具结合在一起跑在docker中实现之前在宿主机中的东西；其实把整个流程梳理清楚后编写yaml文件也很快的。后续尝试放到k8s集群中跑🍺🍺🍺</p>
<p>在我的VPS上面跑起来了… <a href="http://blog.sctux.com:8090" target="_blank" rel="noopener">http://blog.sctux.com:8090</a></p>

      
    </div>
    
    
    
<div>
  
    <div>
    
        <div style="text-align:center;color: #ccc;font-size:14px;">-------------本文结束<i class="fa fa-paw"></i>感谢您的阅读-------------</div>
    
</div>


  
</div>
    

    

    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="../../../../tags/Docker/" rel="tag"># Docker</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="../../08/09k8s-ji-qun-da-jianjian-kong-zhan-shi-jie-mian-an/" rel="next" title="09-K8s集群搭建---监控展示界面安装">
                <i class="fa fa-chevron-left"></i> 09-K8s集群搭建---监控展示界面安装
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="../../27/flask-app-for-kubernetes/" rel="prev" title="Flask App for Kubernetes">
                Flask App for Kubernetes <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          

  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope="" itemtype="http://schema.org/Person">
            
              <img class="site-author-image" itemprop="image" src="https://raw.githubusercontent.com/guomaoqiu/myblog_backup/master/uploads/myphoto.png" alt="OutMan">
            
              <p class="site-author-name" itemprop="name">OutMan</p>
              <p class="site-description motion-element" itemprop="description">😊</p>
          </div>

          <nav class="site-state motion-element">

            
              <div class="site-state-item site-state-posts">
              
                <a href="../../../../archives/">
              
                  <span class="site-state-item-count">79</span>
                  <span class="site-state-item-name">日志</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-categories">
                <a href="../../../../categories/index.html">
                  <span class="site-state-item-count">22</span>
                  <span class="site-state-item-name">分类</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-tags">
                <a href="../../../../tags/index.html">
                  <span class="site-state-item-count">46</span>
                  <span class="site-state-item-name">标签</span>
                </a>
              </div>
            

          </nav>

          

          
            <div class="links-of-author motion-element">
                
                  <span class="links-of-author-item">
                    <a href="https://github.com/guomaoqiu" target="_blank" title="GitHub">
                      
                        <i class="fa fa-fw fa-github"></i></a>
                  </span>
                
                  <span class="links-of-author-item">
                    <a href="mailto:guomaoqiu@google.com" target="_blank" title="E-Mail">
                      
                        <i class="fa fa-fw fa-envelope"></i></a>
                  </span>
                
            </div>
          

          
          

          
          

          

        </div>
      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#部署架构"><span class="nav-number">1.</span> <span class="nav-text">部署架构:</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#访问流程"><span class="nav-number">2.</span> <span class="nav-text">访问流程:</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#简单理解起来就是酱紫的"><span class="nav-number">2.1.</span> <span class="nav-text">简单理解起来就是酱紫的:</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#搭建思路"><span class="nav-number">3.</span> <span class="nav-text">搭建思路:</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#部署步骤："><span class="nav-number">4.</span> <span class="nav-text">部署步骤：</span></a><ol class="nav-child"><li class="nav-item nav-level-5"><a class="nav-link" href="#0-安装docker环境"><span class="nav-number">4.0.0.1.</span> <span class="nav-text">0.安装docker环境</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#1-构建python基础运行环境镜像，基于alpine镜像"><span class="nav-number">4.0.0.2.</span> <span class="nav-text">1.构建python基础运行环境镜像，基于alpine镜像</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#2-构建Flask应用框架运行所需依赖包镜像"><span class="nav-number">4.0.0.3.</span> <span class="nav-text">2.构建Flask应用框架运行所需依赖包镜像</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#4-Nginx镜像使用默认，配置文件需要修改，这里通过挂载方式"><span class="nav-number">4.0.0.4.</span> <span class="nav-text">4.Nginx镜像使用默认，配置文件需要修改，这里通过挂载方式</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#5-Redis镜像使用默认的"><span class="nav-number">4.0.0.5.</span> <span class="nav-text">5.Redis镜像使用默认的</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#6-执行docker-compose"><span class="nav-number">4.0.0.6.</span> <span class="nav-text">6.执行docker-compose</span></a></li></ol></li><li class="nav-item nav-level-4"><a class="nav-link" href="#运行状态"><span class="nav-number">4.0.1.</span> <span class="nav-text">运行状态</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#登录"><span class="nav-number">4.0.2.</span> <span class="nav-text">登录</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#用户注册"><span class="nav-number">4.0.3.</span> <span class="nav-text">用户注册</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#Flask应用的访问、登录、注册过程日志"><span class="nav-number">4.0.4.</span> <span class="nav-text">Flask应用的访问、登录、注册过程日志</span></a><ol class="nav-child"><li class="nav-item nav-level-5"><a class="nav-link" href="#Nginx"><span class="nav-number">4.0.4.1.</span> <span class="nav-text">Nginx</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#uWSGI"><span class="nav-number">4.0.4.2.</span> <span class="nav-text">uWSGI</span></a></li></ol></li></ol><li class="nav-item nav-level-2"><a class="nav-link" href="#部署总结"><span class="nav-number">5.</span> <span class="nav-text">部署总结:</span></a></li></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; <span itemprop="copyrightYear">2018</span>
  <span class="with-love">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">OutMan</span>

  
</div>


  <div class="powered-by">由 <a class="theme-link" target="_blank" href="https://hexo.io">Hexo</a> 强力驱动</div>



  <span class="post-meta-divider">|</span>



  <div class="theme-info">主题 &mdash; <a class="theme-link" target="_blank" href="https://github.com/iissnan/hexo-theme-next">NexT.Gemini</a> v5.1.4</div>




        







        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  


  











  
  
    <script type="text/javascript" src="../../../../lib/jquery/index.js?v=2.1.3"></script>
  

  
  
    <script type="text/javascript" src="../../../../lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>
  

  
  
    <script type="text/javascript" src="../../../../lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>
  

  
  
    <script type="text/javascript" src="../../../../lib/velocity/velocity.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="../../../../lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="../../../../lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
  

  
  
    <script type="text/javascript" src="../../../../lib/canvas-nest/canvas-nest.min.js"></script>
  


  


  <script type="text/javascript" src="../../../../js/src/utils.js?v=5.1.4"></script>

  <script type="text/javascript" src="../../../../js/src/motion.js?v=5.1.4"></script>



  
  


  <script type="text/javascript" src="../../../../js/src/affix.js?v=5.1.4"></script>

  <script type="text/javascript" src="../../../../js/src/schemes/pisces.js?v=5.1.4"></script>



  
  <script type="text/javascript" src="../../../../js/src/scrollspy.js?v=5.1.4"></script>
<script type="text/javascript" src="../../../../js/src/post-details.js?v=5.1.4"></script>



  


  <script type="text/javascript" src="../../../../js/src/bootstrap.js?v=5.1.4"></script>



  


  




	





  





  












  





  

  

  

  
  

  

  

  

</body>
</html>
